<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function unlink(arr) {
            for (var i = 0; i < arr.length; i++) {    // 首次遍历数组
                for (var j= i + 1;j<arr.length;j++) {   // 再次遍历数组
                    if (arr[i] == arr[j]) {          // 判断连个值是否相等
                        arr.splice(j, 1);           // 相等删除后者
                        j--;
                    }
                }
            }
            return arr
        }
        var arr = ['apple','banana','pear','apple','orange','orange'];
        console.log(unlink(arr));
    </script>
</body>

</html>